using System;
using bitzhuwei.Compiler;

namespace bitzhuwei.AnsiCFormat {
    /// <summary>
    /// Correspond to the Vn node abstract_declarator in the grammar(AnsiC).
    /// </summary>
    internal partial class Vnabstract_declarator : IFullFormat {
        // [155] abstract_declarator = pointer ;
        // [156] abstract_declarator = direct_abstract_declarator ;
        // [157] abstract_declarator = pointer direct_abstract_declarator ;


        private readonly IFullFormat complex;

        private readonly TokenRange _scope;
        public TokenRange Scope => _scope;
        public void FullFormat(BlankConfig? preConfig, TextWriter writer, FormatContext context) {
            context.PrintBlanksAnd(this.complex, preConfig, writer);
        }


        // [155] abstract_declarator = pointer ;
        public Vnabstract_declarator(Vnpointer r0) {
            this.complex = new complex0(r0);
            this._scope = new TokenRange(r0);
        }
        class complex0 : IFullFormat {
            private readonly TokenRange _scope;
            public TokenRange Scope => _scope;
            public void FullFormat(BlankConfig? preConfig, TextWriter writer, FormatContext context) {
                context.PrintBlanksAnd(r0, preConfig, writer);
            }
            public readonly Vnpointer r0;
            public complex0(Vnpointer r0) {
                this.r0 = r0;
                this._scope = new TokenRange(r0);
            }
        }

        // [156] abstract_declarator = direct_abstract_declarator ;
        public Vnabstract_declarator(Vndirect_abstract_declarator r0) {
            this.complex = new complex1(r0);
            this._scope = new TokenRange(r0);
        }
        class complex1 : IFullFormat {
            private readonly TokenRange _scope;
            public TokenRange Scope => _scope;
            public void FullFormat(BlankConfig? preConfig, TextWriter writer, FormatContext context) {
                context.PrintBlanksAnd(r0, preConfig, writer);
            }
            public readonly Vndirect_abstract_declarator r0;
            public complex1(Vndirect_abstract_declarator r0) {
                this.r0 = r0;
                this._scope = new TokenRange(r0);
            }
        }

        // [157] abstract_declarator = pointer direct_abstract_declarator ;
        public Vnabstract_declarator(Vnpointer r1, Vndirect_abstract_declarator r0) {
            this.complex = new complex2(r1, r0);
            this._scope = new TokenRange(r1, r0);
        }
        class complex2 : IFullFormat {
            private readonly TokenRange _scope;
            public TokenRange Scope => _scope;
            public void FullFormat(BlankConfig? preConfig, TextWriter writer, FormatContext context) {
                var config = new BlankConfig();
                context.PrintBlanksAnd(r1, preConfig, writer);
                context.PrintCommentsBetween(r1, r0, config, writer);
                context.PrintBlanksAnd(r0, config, writer);
            }
            public readonly Vnpointer r1;
            public readonly Vndirect_abstract_declarator r0;
            public complex2(Vnpointer r1, Vndirect_abstract_declarator r0) {
                this.r1 = r1;
                this.r0 = r0;
                this._scope = new TokenRange(r1, r0);
            }
        }



    }
}
